/**
 * @file   1017.cpp
 * @author Shuang Hu <hsmath@ubuntu>
 * @date   Tue Jul 20 03:21:34 2021
 * 
 * @brief  PAT advanced 1017
 * 
 * 
 */
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
using namespace std;
class user{
public:
    int arriving;
    int beginning;
    int dure;
};
int change(int a,int b,int c){
    return (a*3600+b*60+c);
}
bool cmp(user& U1,user& U2){
    return U1.arriving<U2.arriving;
}
int findmin(vector<int>& vec){
    int flag=0;
    int minvalue=vec[0];
    for(int i=0;i<vec.size();i++){
	if(vec[i]<minvalue){
	    minvalue=vec[i];
	    flag=i;
	}
    }
    return flag;
}
class Solution{
private:
    vector<user> userinfo;
    int tablenum;
    vector<int> tableinfo;
public:
    Solution();
    void solve();
    void print();
};
Solution::Solution(){
    int inputnum;
    cin>>inputnum>>tablenum;
    tableinfo.resize(tablenum);
    for(int i=0;i<inputnum;i++){
	user U;
	int h,m,s;
	scanf("%d:%d:%d",&h,&m,&s);
	int time=change(h,m,s);
	int d;
	cin>>d;
	d=d*60;
	if(time>17*3600){
	    continue;//Not Marked!
	}
	U.arriving=time;
	U.dure=min(d,3600);
	userinfo.push_back(U);
    }
    sort(userinfo.begin(),userinfo.end(),cmp);
}
void Solution::solve(){
    for(int i=0;i<userinfo.size();i++){
	int index=findmin(tableinfo);
	int para1=max(userinfo[i].arriving,tableinfo[index]);
	userinfo[i].beginning=max(para1,8*3600);
	tableinfo[index]=userinfo[i].beginning+userinfo[i].dure;
    }
}
void Solution::print(){
    int time=0;
    for(int i=0;i<userinfo.size();i++){
	time=time+userinfo[i].beginning-userinfo[i].arriving;
    }
    double avg=0;
    avg=time*1.0/(60*userinfo.size());
    cout<<fixed<<setprecision(1)<<avg<<endl;
}
int main(){
    Solution S;
    S.solve();
    S.print();
}
